import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {
  IncomeYearlySummaryForm,
  IncomeYearlySummaryQuery,
  IncomeYearlySummaryVO
} from '@/api/biz/incomeYearlySummary/types';

/**
 * 查询年收入汇总列表
 * @param query
 * @returns {*}
 */

export const listYearlyIncomeSummary = (query?: IncomeYearlySummaryQuery): AxiosPromise<IncomeYearlySummaryVO[]> => {
  return request({
    url: '/biz/incomeYearlySummary/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询年收入汇总详细
 * @param id
 */
export const getYearlyIncomeSummary = (id: string | number): AxiosPromise<IncomeYearlySummaryVO> => {
  return request({
    url: '/biz/incomeYearlySummary/' + id,
    method: 'get'
  });
};

/**
 * 新增年收入汇总
 * @param data
 */
export const addYearlyIncomeSummary = (data: IncomeYearlySummaryForm) => {
  return request({
    url: '/biz/incomeYearlySummary',
    method: 'post',
    data: data
  });
};

/**
 * 修改年收入汇总
 * @param data
 */
export const updateYearlyIncomeSummary = (data: IncomeYearlySummaryForm) => {
  return request({
    url: '/biz/incomeYearlySummary',
    method: 'put',
    data: data
  });
};

/**
 * 删除年收入汇总
 * @param id
 */
export const delYearlyIncomeSummary = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/incomeYearlySummary/' + id,
    method: 'delete'
  });
};
